import { useNavigation,NavigationProp } from '@react-navigation/native';



type RootStackParamsList = {
    Withdrawal:{}
    WithdrawalHistory:{}
    BindAliPayScreen:{}
    CustomerService:{}
    Setting:{},
    Login:{}
}

type RootStackNavigationProp = NavigationProp<RootStackParamsList>



export const useNavigate = function() {
    const navigate = useNavigation<RootStackNavigationProp>();


    /**
     * 提现页面
     * @param params
     */
    const navigateWithdrawal = (params = {}) => {
        navigate.navigate('Withdrawal',params);
    };


    /**
     * 提现历史
     * @param params
     */
    const navigateWithdrawalHistory = (params = {}) => {
        navigate.navigate('WithdrawalHistory',params);
    };


    /**
     * 绑定支付宝
     * @param params
     */
    const navigateBindAliPay = (params = {}) => {
        navigate.navigate('BindAliPayScreen',params);
    };


    /**
     * 联系客服
     * @param params
     */
    const navigateCustomerService = (params = {}) => {
        navigate.navigate('CustomerService',params);
    };

    /**
     * 设置
     * @param params
     */
    const navigateSetting = (params = {}) => {
        navigate.navigate('Setting',params);
    };



    const navigateLogin = (params = {}) => {
        navigate.navigate('Login',params);
    };

    return {
        navigateWithdrawal,
        navigateWithdrawalHistory,
        navigateBindAliPay,
        navigateCustomerService,
        navigateSetting,
        navigateLogin,
    };
};
